﻿Public Class CheckedListBoxTarea

    Private Sub CheckedListBoxTarea_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For elemento As Integer = 1 To 9 Step 1
            Me.CheckedListBox1.Items.Add(elemento.ToString())
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.CheckedListBox1.Items.Add(Me.TextBox1.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        MessageBox.Show("Hay " & Me.CheckedListBox1.CheckedItems.Count & " seleccionados")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim checked As CheckedListBox.CheckedItemCollection
        checked = Me.CheckedListBox1.CheckedItems
        For Each item As Object In checked
            Me.CheckedListBox2.Items.Add(item.ToString)
        Next
        For i As Integer = 0 To checked.Count - 1
            Me.CheckedListBox1.SetItemChecked(Me.CheckedListBox1.CheckedIndices(0), False)

        Next
    End Sub
End Class